package com.bosch.in.rtp1.ept.util;

import java.util.ArrayList;
import java.util.List;

import com.bosch.in.rtp1.ept.constant.CommonConstants;
import com.bosch.in.rtp1.ept.constant.FinishRecipeConstant;
import com.bosch.in.rtp1.ept.constant.ReleasedHoldParameter;
import com.bosch.in.rtp1.ept.model.dto.SelectingInt;

public class FormUtility {
	
	/**
	 * Create list of SelectingInt object which represents value of the year
	 * @return List<SelectingInt>
	 */
	public static List<SelectingInt> buildListYears()
	{
		List<SelectingInt> years = new ArrayList<SelectingInt>(); 
		for (int i = CommonConstants.CURRENT_YEAR-CommonConstants.NUM_OF_LAST_YEAR; i<=CommonConstants.CURRENT_YEAR + CommonConstants.NUM_OF_NEXT_YEAR; ++i)
		{
			SelectingInt selectingInt = new SelectingInt();
			selectingInt.setValue(i);
			years.add(selectingInt);
		}
		return years;
	}
	
	/**
	 * Create list of SelectingInt object which represents value of the month
	 * @return List<SelectingInt>
	 */
	public static List<SelectingInt> buildListMonths()
	{
		List<SelectingInt> months = new ArrayList<SelectingInt>(); 
		for (int i = CommonConstants.START_MONTH_INDEX; i<=CommonConstants.END_MONTH_INDEX; ++i)
		{
			SelectingInt selectingInt = new SelectingInt();
			selectingInt.setValue(i);
			selectingInt.setDisplay(CommonConstants.MONTH_LIST[i]);
			months.add(selectingInt);
		}
		return months;
	}
	
	/**
	 * Create list of SelectingInt object which represents value of the type of diagram
	 * @return List<SelectingInt>
	 */
	public static List<SelectingInt> buildDiagramType() {
		List<SelectingInt> diagramTypes = new ArrayList<SelectingInt>();
		for (int i=0; i<ReleasedHoldParameter.DIAGRAM_TYPE_COUNT;++i)
		{
			SelectingInt sInt = new SelectingInt();
			sInt.setDisplay(ReleasedHoldParameter.DIAGRAM_TYPE_LIST[i]);
			sInt.setValue(i);
			diagramTypes.add(sInt);
		}
		return diagramTypes;
	}
	
	/**
	 * Create list of SelectingInt object which represents value of the ProdArea
	 * @return List<SelectingInt>
	 */
	public static List<SelectingInt> buildListProdArea()
	{
		List<SelectingInt> prodAreas = new ArrayList<SelectingInt>();
		for (int i=0; i<FinishRecipeConstant.NUM_OF_PROD_AREA; ++ i)
		{
			SelectingInt selectingInt = new SelectingInt();
			selectingInt.setDisplay(FinishRecipeConstant.PROD_AREA_LIST[i]);
			selectingInt.setValue(i+1);
			prodAreas.add(selectingInt);
		}
		return prodAreas;
	}
	
	/**
	 * Create list of SelectingInt object which represents value of the Priority
	 * @return List<SelectingInt>
	 */
	public static List<SelectingInt> buildListPriority()
	{
		List<SelectingInt> priorities = new ArrayList<SelectingInt>(); 
		for (int i = 0; i<FinishRecipeConstant.NUM_OF_PRIORITY ; ++i)
		{
			SelectingInt selectingInt = new SelectingInt();
			selectingInt.setValue(FinishRecipeConstant.PRIORITY_LIST[i]);
			priorities.add(selectingInt);
		}
		return priorities;
	}

}
